agora inbox for [email protected]
help / color / mirror / Atom feed[PATCH 4/4] add force_incremental_sort GUC
467+ messages / 4 participants
[nested] [flat]
* [PATCH 4/4] add force_incremental_sort GUC
@ 2019-07-09 11:36 Tomas Vondra <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Tomas Vondra @ 2019-07-09 11:36 UTC (permalink / raw)
---
src/backend/optimizer/path/costsize.c | 8 ++++++++
src/backend/utils/misc/guc.c | 10 ++++++++++
src/include/optimizer/cost.h | 1 +
3 files changed, 19 insertions(+)
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index c6aa17ba67..ee4487b158 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -140,6 +140,8 @@ bool enable_parallel_append = true;
bool enable_parallel_hash = true;
bool enable_partition_pruning = true;
+bool force_incremental_sort = true;
+
typedef struct
{
PlannerInfo *root;
@@ -1907,6 +1909,12 @@ cost_incremental_sort(Path *path,
path->rows = input_tuples;
path->startup_cost = startup_cost;
path->total_cost = startup_cost + run_cost;
+
+ if (force_incremental_sort)
+ {
+ path->startup_cost = input_startup_cost;
+ path->total_cost = input_total_cost;
+ }
}
/*
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index f922ee66a0..d2cc5b56b5 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -941,6 +941,16 @@ static struct config_bool ConfigureNamesBool[] =
true,
NULL, NULL, NULL
},
+ {
+ {"force_incremental_sort", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("Makes the incremental sort look like no-cost."),
+ NULL,
+ GUC_EXPLAIN
+ },
+ &force_incremental_sort,
+ false,
+ NULL, NULL, NULL
+ },
{
{"enable_incrementalsort", PGC_USERSET, QUERY_TUNING_METHOD,
gettext_noop("Enables the planner's use of incremental sort steps."),
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h
index b9d7a77e65..bad1d5a330 100644
--- a/src/include/optimizer/cost.h
+++ b/src/include/optimizer/cost.h
@@ -66,6 +66,7 @@ extern PGDLLIMPORT bool enable_parallel_append;
extern PGDLLIMPORT bool enable_parallel_hash;
extern PGDLLIMPORT bool enable_partition_pruning;
extern PGDLLIMPORT int constraint_exclusion;
+extern PGDLLIMPORT bool force_incremental_sort;
extern double index_pages_fetched(double tuples_fetched, BlockNumber pages,
double index_pages, PlannerInfo *root);
--
2.21.0
--z44ikx7gwyo2xwzv--
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v1 8/9] ci: Don't specify amount of memory
@ 2023-08-08 00:31 Andres Freund <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Andres Freund @ 2023-08-08 00:31 UTC (permalink / raw)
The number of CPUs is the cost-determining factor. Most instance types that
run tests have more memory/core than what we specified, there's no real
benefit in wasting that.
---
.cirrus.yml | 4 ----
1 file changed, 4 deletions(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index ef825485826..a4d64955489 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -150,7 +150,6 @@ task:
image: family/pg-ci-freebsd-13
platform: freebsd
cpu: $CPUS
- memory: 4G
disk: 50
sysinfo_script: |
@@ -292,7 +291,6 @@ task:
image: family/pg-ci-bullseye
platform: linux
cpu: $CPUS
- memory: 4G
ccache_cache:
folder: ${CCACHE_DIR}
@@ -554,7 +552,6 @@ task:
image: family/pg-ci-windows-ci-vs-2019
platform: windows
cpu: $CPUS
- memory: 4G
setup_additional_packages_script: |
REM choco install -y --no-progress ...
@@ -604,7 +601,6 @@ task:
image: family/pg-ci-windows-ci-mingw64
platform: windows
cpu: $CPUS
- memory: 4G
env:
TEST_JOBS: 4 # higher concurrency causes occasional failures
--
2.38.0
--uu4yojthqnm7ulmd--
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v1 8/9] ci: Don't specify amount of memory
@ 2023-08-08 00:31 Andres Freund <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Andres Freund @ 2023-08-08 00:31 UTC (permalink / raw)
The number of CPUs is the cost-determining factor. Most instance types that
run tests have more memory/core than what we specified, there's no real
benefit in wasting that.
---
.cirrus.yml | 4 ----
1 file changed, 4 deletions(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index ef825485826..a4d64955489 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -150,7 +150,6 @@ task:
image: family/pg-ci-freebsd-13
platform: freebsd
cpu: $CPUS
- memory: 4G
disk: 50
sysinfo_script: |
@@ -292,7 +291,6 @@ task:
image: family/pg-ci-bullseye
platform: linux
cpu: $CPUS
- memory: 4G
ccache_cache:
folder: ${CCACHE_DIR}
@@ -554,7 +552,6 @@ task:
image: family/pg-ci-windows-ci-vs-2019
platform: windows
cpu: $CPUS
- memory: 4G
setup_additional_packages_script: |
REM choco install -y --no-progress ...
@@ -604,7 +601,6 @@ task:
image: family/pg-ci-windows-ci-mingw64
platform: windows
cpu: $CPUS
- memory: 4G
env:
TEST_JOBS: 4 # higher concurrency causes occasional failures
--
2.38.0
--uu4yojthqnm7ulmd--
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 01/10] ci: Don't specify amount of memory
@ 2023-08-08 00:31 Andres Freund <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Andres Freund @ 2023-08-08 00:31 UTC (permalink / raw)
The number of CPUs is the cost-determining factor. Most instance types that
run tests have more memory/core than what we specified, there's no real
benefit in wasting that.
Discussion: https://postgr.es/m/[email protected]
Backpatch: 15-, where CI support was added
---
.cirrus.yml | 4 ----
1 file changed, 4 deletions(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index 727c434de40..9e84eb95be5 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -149,7 +149,6 @@ task:
image: family/pg-ci-freebsd-13
platform: freebsd
cpu: $CPUS
- memory: 4G
disk: 50
sysinfo_script: |
@@ -291,7 +290,6 @@ task:
image: family/pg-ci-bullseye
platform: linux
cpu: $CPUS
- memory: 4G
ccache_cache:
folder: ${CCACHE_DIR}
@@ -558,7 +556,6 @@ task:
image: family/pg-ci-windows-ci-vs-2019
platform: windows
cpu: $CPUS
- memory: 4G
setup_additional_packages_script: |
REM choco install -y --no-progress ...
@@ -606,7 +603,6 @@ task:
image: family/pg-ci-windows-ci-mingw64
platform: windows
cpu: $CPUS
- memory: 4G
env:
TEST_JOBS: 4 # higher concurrency causes occasional failures
--
2.38.0
--uh2yukyzfvojbe2k
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v3-0002-ci-Move-execution-method-of-tasks-into-yaml-templ.patch"
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v1 8/9] ci: Don't specify amount of memory
@ 2023-08-08 00:31 Andres Freund <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Andres Freund @ 2023-08-08 00:31 UTC (permalink / raw)
The number of CPUs is the cost-determining factor. Most instance types that
run tests have more memory/core than what we specified, there's no real
benefit in wasting that.
---
.cirrus.yml | 4 ----
1 file changed, 4 deletions(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index ef825485826..a4d64955489 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -150,7 +150,6 @@ task:
image: family/pg-ci-freebsd-13
platform: freebsd
cpu: $CPUS
- memory: 4G
disk: 50
sysinfo_script: |
@@ -292,7 +291,6 @@ task:
image: family/pg-ci-bullseye
platform: linux
cpu: $CPUS
- memory: 4G
ccache_cache:
folder: ${CCACHE_DIR}
@@ -554,7 +552,6 @@ task:
image: family/pg-ci-windows-ci-vs-2019
platform: windows
cpu: $CPUS
- memory: 4G
setup_additional_packages_script: |
REM choco install -y --no-progress ...
@@ -604,7 +601,6 @@ task:
image: family/pg-ci-windows-ci-mingw64
platform: windows
cpu: $CPUS
- memory: 4G
env:
TEST_JOBS: 4 # higher concurrency causes occasional failures
--
2.38.0
--uu4yojthqnm7ulmd--
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 01/10] ci: Don't specify amount of memory
@ 2023-08-08 00:31 Andres Freund <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Andres Freund @ 2023-08-08 00:31 UTC (permalink / raw)
The number of CPUs is the cost-determining factor. Most instance types that
run tests have more memory/core than what we specified, there's no real
benefit in wasting that.
Discussion: https://postgr.es/m/[email protected]
Backpatch: 15-, where CI support was added
---
.cirrus.yml | 4 ----
1 file changed, 4 deletions(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index 727c434de40..9e84eb95be5 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -149,7 +149,6 @@ task:
image: family/pg-ci-freebsd-13
platform: freebsd
cpu: $CPUS
- memory: 4G
disk: 50
sysinfo_script: |
@@ -291,7 +290,6 @@ task:
image: family/pg-ci-bullseye
platform: linux
cpu: $CPUS
- memory: 4G
ccache_cache:
folder: ${CCACHE_DIR}
@@ -558,7 +556,6 @@ task:
image: family/pg-ci-windows-ci-vs-2019
platform: windows
cpu: $CPUS
- memory: 4G
setup_additional_packages_script: |
REM choco install -y --no-progress ...
@@ -606,7 +603,6 @@ task:
image: family/pg-ci-windows-ci-mingw64
platform: windows
cpu: $CPUS
- memory: 4G
env:
TEST_JOBS: 4 # higher concurrency causes occasional failures
--
2.38.0
--uh2yukyzfvojbe2k
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v3-0002-ci-Move-execution-method-of-tasks-into-yaml-templ.patch"
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v11 1/2] Key PGSTAT_KIND_RELATION by relfile locator
@ 2025-10-01 09:45 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Bertrand Drouvot @ 2025-10-01 09:45 UTC (permalink / raw)
This patch changes the key used for the PGSTAT_KIND_RELATION statistic kind.
Instead of the relation oid, it now relies on:
- dboid (linked to RelFileLocator's dbOid)
- objoid which is the result of a new macro (namely RelFileLocatorToPgStatObjid())
that computes an objoid based on the RelFileLocator's spcOid and the
RelFileLocator's relNumber.
This is possible as, since b14e9ce7d55c, the objoid is now uint64 and spcOid
and relNumber are 32 bits.
That will allow us to add new stats (add writes counters) and ensure that some
counters (n_dead_tup and friends) are replicated.
The patch introduces pgstat_reloid_to_relfilelocator() to 1) avoid calling
RelationIdGetRelation() to get the relfilelocator based on the relation oid
and 2) handle the partitioned table case.
Please note that:
- when running pg_stat_have_stats('relation',...) we now need to be connected
to the database that hosts the relation. As pg_stat_have_stats() is not
documented publicly, then the changes done in 029_stats_restart.pl look
enough.
- this patch does not handle rewrites so some tests are failing. It's only
intent is to ease the review and should not be pushed without being
merged with the following patch that handles the rewrites.
- it can be used to test that stats are incremented correctly and that we're
able to retrieve them as long as rewrites are not involved.
---
src/backend/postmaster/autovacuum.c | 17 +-
src/backend/utils/activity/pgstat_relation.c | 236 ++++++++++++++++---
src/backend/utils/adt/pgstatfuncs.c | 22 +-
src/include/catalog/pg_tablespace.dat | 4 +
src/include/catalog/pg_tablespace.h | 8 +
src/include/pgstat.h | 15 +-
src/include/utils/pgstat_internal.h | 1 +
src/test/recovery/t/029_stats_restart.pl | 40 ++--
8 files changed, 271 insertions(+), 72 deletions(-)
6.1% src/backend/postmaster/
61.6% src/backend/utils/activity/
5.1% src/backend/utils/adt/
3.2% src/include/catalog/
5.6% src/include/
18.1% src/test/recovery/t/
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 6fde740465f..4bd5a6824bd 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1990,12 +1990,16 @@ do_autovacuum(void)
bool dovacuum;
bool doanalyze;
bool wraparound;
+ RelFileLocator locator;
if (classForm->relkind != RELKIND_RELATION &&
classForm->relkind != RELKIND_MATVIEW)
continue;
relid = classForm->oid;
+ locator.dbOid = classForm->relisshared ? InvalidOid : MyDatabaseId;
+ locator.spcOid = classForm->reltablespace;
+ locator.relNumber = classForm->relfilenode;
/*
* Check if it is a temp table (presumably, of some other backend's).
@@ -2024,8 +2028,7 @@ do_autovacuum(void)
/* Fetch reloptions and the pgstat entry for this table */
relopts = extract_autovac_opts(tuple, pg_class_desc);
- tabentry = pgstat_fetch_stat_tabentry_ext(classForm->relisshared,
- relid);
+ tabentry = pgstat_fetch_stat_tabentry_by_locator(locator);
/* Check if it needs vacuum or analyze */
relation_needs_vacanalyze(relid, relopts, classForm, tabentry,
@@ -2090,6 +2093,7 @@ do_autovacuum(void)
bool dovacuum;
bool doanalyze;
bool wraparound;
+ RelFileLocator locator;
/*
* We cannot safely process other backends' temp tables, so skip 'em.
@@ -2098,6 +2102,9 @@ do_autovacuum(void)
continue;
relid = classForm->oid;
+ locator.dbOid = classForm->relisshared ? InvalidOid : MyDatabaseId;
+ locator.spcOid = classForm->reltablespace;
+ locator.relNumber = classForm->relfilenode;
/*
* fetch reloptions -- if this toast table does not have them, try the
@@ -2117,8 +2124,7 @@ do_autovacuum(void)
}
/* Fetch the pgstat entry for this table */
- tabentry = pgstat_fetch_stat_tabentry_ext(classForm->relisshared,
- relid);
+ tabentry = pgstat_fetch_stat_tabentry_by_locator(locator);
relation_needs_vacanalyze(relid, relopts, classForm, tabentry,
effective_multixact_freeze_max_age,
@@ -2915,8 +2921,7 @@ recheck_relation_needs_vacanalyze(Oid relid,
PgStat_StatTabEntry *tabentry;
/* fetch the pgstat table entry */
- tabentry = pgstat_fetch_stat_tabentry_ext(classForm->relisshared,
- relid);
+ tabentry = pgstat_fetch_stat_tabentry_ext(relid);
relation_needs_vacanalyze(relid, avopts, classForm, tabentry,
effective_multixact_freeze_max_age,
diff --git a/src/backend/utils/activity/pgstat_relation.c b/src/backend/utils/activity/pgstat_relation.c
index bc8c43b96aa..89bf0cbed56 100644
--- a/src/backend/utils/activity/pgstat_relation.c
+++ b/src/backend/utils/activity/pgstat_relation.c
@@ -17,12 +17,17 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/twophase_rmgr.h"
#include "access/xact.h"
#include "catalog/catalog.h"
+#include "catalog/pg_tablespace.h"
+#include "storage/lmgr.h"
#include "utils/memutils.h"
#include "utils/pgstat_internal.h"
#include "utils/rel.h"
+#include "utils/relmapper.h"
+#include "utils/syscache.h"
#include "utils/timestamp.h"
@@ -36,13 +41,12 @@ typedef struct TwoPhasePgStatRecord
PgStat_Counter inserted_pre_truncdrop;
PgStat_Counter updated_pre_truncdrop;
PgStat_Counter deleted_pre_truncdrop;
- Oid id; /* table's OID */
- bool shared; /* is it a shared catalog? */
+ RelFileLocator locator; /* table's rd_locator */
bool truncdropped; /* was the relation truncated/dropped? */
} TwoPhasePgStatRecord;
-static PgStat_TableStatus *pgstat_prep_relation_pending(Oid rel_id, bool isshared);
+static PgStat_TableStatus *pgstat_prep_relation_pending(RelFileLocator locator);
static void add_tabstat_xact_level(PgStat_TableStatus *pgstat_info, int nest_level);
static void ensure_tabstat_xact_level(PgStat_TableStatus *pgstat_info);
static void save_truncdrop_counters(PgStat_TableXactStatus *trans, bool is_drop);
@@ -60,8 +64,7 @@ pgstat_copy_relation_stats(Relation dst, Relation src)
PgStatShared_Relation *dstshstats;
PgStat_EntryRef *dst_ref;
- srcstats = pgstat_fetch_stat_tabentry_ext(src->rd_rel->relisshared,
- RelationGetRelid(src));
+ srcstats = pgstat_fetch_stat_tabentry_ext(RelationGetRelid(src));
if (!srcstats)
return;
@@ -94,8 +97,10 @@ pgstat_init_relation(Relation rel)
/*
* We only count stats for relations with storage and partitioned tables
+ * and we don't count stats generated during a rewrite.
*/
- if (!RELKIND_HAS_STORAGE(relkind) && relkind != RELKIND_PARTITIONED_TABLE)
+ if ((!RELKIND_HAS_STORAGE(relkind) && relkind != RELKIND_PARTITIONED_TABLE) ||
+ OidIsValid(rel->rd_rel->relrewrite))
{
rel->pgstat_enabled = false;
rel->pgstat_info = NULL;
@@ -130,12 +135,37 @@ pgstat_init_relation(Relation rel)
void
pgstat_assoc_relation(Relation rel)
{
+ RelFileLocator locator;
+
Assert(rel->pgstat_enabled);
Assert(rel->pgstat_info == NULL);
+ /*
+ * Don't associate stats for relations without storage and non partitioned
+ * tables.
+ */
+ if (!RELKIND_HAS_STORAGE(rel->rd_rel->relkind) &&
+ rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
+ return;
+
+ if (rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
+ locator = rel->rd_locator;
+ else
+ {
+ /*
+ * Partitioned tables don't have storage, so construct a synthetic
+ * locator for statistics tracking. Use a reserved pseudo tablespace
+ * OID that cannot conflict with real tablespaces, and the relation
+ * OID as relNumber. This ensures no collision with regular relations
+ * even after OID wraparound.
+ */
+ locator.dbOid = (rel->rd_rel->relisshared ? InvalidOid : MyDatabaseId);
+ locator.spcOid = PSEUDO_PARTITION_TABLE_SPCOID;
+ locator.relNumber = rel->rd_id;
+ }
+
/* Else find or make the PgStat_TableStatus entry, and update link */
- rel->pgstat_info = pgstat_prep_relation_pending(RelationGetRelid(rel),
- rel->rd_rel->relisshared);
+ rel->pgstat_info = pgstat_prep_relation_pending(locator);
/* don't allow link a stats to multiple relcache entries */
Assert(rel->pgstat_info->relation == NULL);
@@ -167,9 +197,13 @@ pgstat_unlink_relation(Relation rel)
void
pgstat_create_relation(Relation rel)
{
+ /* don't track stats for relations without storage */
+ if (!RELKIND_HAS_STORAGE(rel->rd_rel->relkind))
+ return;
+
pgstat_create_transactional(PGSTAT_KIND_RELATION,
- rel->rd_rel->relisshared ? InvalidOid : MyDatabaseId,
- RelationGetRelid(rel));
+ rel->rd_locator.dbOid,
+ RelFileLocatorToPgStatObjid(rel->rd_locator));
}
/*
@@ -181,9 +215,13 @@ pgstat_drop_relation(Relation rel)
int nest_level = GetCurrentTransactionNestLevel();
PgStat_TableStatus *pgstat_info;
+ /* don't track stats for relations without storage */
+ if (!RELKIND_HAS_STORAGE(rel->rd_rel->relkind))
+ return;
+
pgstat_drop_transactional(PGSTAT_KIND_RELATION,
- rel->rd_rel->relisshared ? InvalidOid : MyDatabaseId,
- RelationGetRelid(rel));
+ rel->rd_locator.dbOid,
+ RelFileLocatorToPgStatObjid(rel->rd_locator));
if (!pgstat_should_count_relation(rel))
return;
@@ -213,20 +251,23 @@ pgstat_report_vacuum(Relation rel, PgStat_Counter livetuples,
PgStat_EntryRef *entry_ref;
PgStatShared_Relation *shtabentry;
PgStat_StatTabEntry *tabentry;
- Oid dboid = (rel->rd_rel->relisshared ? InvalidOid : MyDatabaseId);
TimestampTz ts;
PgStat_Counter elapsedtime;
+ RelFileLocator locator;
if (!pgstat_track_counts)
return;
+ locator = rel->rd_locator;
+
/* Store the data in the table's hash table entry. */
ts = GetCurrentTimestamp();
elapsedtime = TimestampDifferenceMilliseconds(starttime, ts);
/* block acquiring lock for the same reason as pgstat_report_autovac() */
- entry_ref = pgstat_get_entry_ref_locked(PGSTAT_KIND_RELATION, dboid,
- RelationGetRelid(rel), false);
+ entry_ref = pgstat_get_entry_ref_locked(PGSTAT_KIND_RELATION, locator.dbOid,
+ RelFileLocatorToPgStatObjid(locator),
+ false);
shtabentry = (PgStatShared_Relation *) entry_ref->shared_stats;
tabentry = &shtabentry->stats;
@@ -285,9 +326,9 @@ pgstat_report_analyze(Relation rel,
PgStat_EntryRef *entry_ref;
PgStatShared_Relation *shtabentry;
PgStat_StatTabEntry *tabentry;
- Oid dboid = (rel->rd_rel->relisshared ? InvalidOid : MyDatabaseId);
TimestampTz ts;
PgStat_Counter elapsedtime;
+ RelFileLocator locator;
if (!pgstat_track_counts)
return;
@@ -325,9 +366,25 @@ pgstat_report_analyze(Relation rel,
ts = GetCurrentTimestamp();
elapsedtime = TimestampDifferenceMilliseconds(starttime, ts);
+ if (rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
+ locator = rel->rd_locator;
+ else
+ {
+ /*
+ * Partitioned tables don't have storage, so construct a synthetic
+ * locator for statistics tracking. Use a reserved pseudo tablespace
+ * OID that cannot conflict with real tablespaces, and the relation
+ * OID as relNumber. This ensures no collision with regular relations
+ * even after OID wraparound.
+ */
+ locator.dbOid = (rel->rd_rel->relisshared ? InvalidOid : MyDatabaseId);
+ locator.spcOid = PSEUDO_PARTITION_TABLE_SPCOID;
+ locator.relNumber = rel->rd_id;
+ }
/* block acquiring lock for the same reason as pgstat_report_autovac() */
- entry_ref = pgstat_get_entry_ref_locked(PGSTAT_KIND_RELATION, dboid,
- RelationGetRelid(rel),
+ entry_ref = pgstat_get_entry_ref_locked(PGSTAT_KIND_RELATION,
+ locator.dbOid,
+ RelFileLocatorToPgStatObjid(locator),
false);
/* can't get dropped while accessed */
Assert(entry_ref != NULL && entry_ref->shared_stats != NULL);
@@ -468,7 +525,16 @@ pgstat_update_heap_dead_tuples(Relation rel, int delta)
PgStat_StatTabEntry *
pgstat_fetch_stat_tabentry(Oid relid)
{
- return pgstat_fetch_stat_tabentry_ext(IsSharedRelation(relid), relid);
+ return pgstat_fetch_stat_tabentry_ext(relid);
+}
+
+PgStat_StatTabEntry *
+pgstat_fetch_stat_tabentry_by_locator(RelFileLocator locator)
+{
+ return (PgStat_StatTabEntry *) pgstat_fetch_entry(
+ PGSTAT_KIND_RELATION,
+ locator.dbOid,
+ RelFileLocatorToPgStatObjid(locator));
}
/*
@@ -476,12 +542,14 @@ pgstat_fetch_stat_tabentry(Oid relid)
* whether the to-be-accessed table is a shared relation or not.
*/
PgStat_StatTabEntry *
-pgstat_fetch_stat_tabentry_ext(bool shared, Oid reloid)
+pgstat_fetch_stat_tabentry_ext(Oid reloid)
{
- Oid dboid = (shared ? InvalidOid : MyDatabaseId);
+ RelFileLocator locator;
- return (PgStat_StatTabEntry *)
- pgstat_fetch_entry(PGSTAT_KIND_RELATION, dboid, reloid);
+ if (!pgstat_reloid_to_relfilelocator(reloid, &locator))
+ return NULL;
+
+ return pgstat_fetch_stat_tabentry_by_locator(locator);
}
/*
@@ -503,14 +571,17 @@ find_tabstat_entry(Oid rel_id)
PgStat_TableXactStatus *trans;
PgStat_TableStatus *tabentry = NULL;
PgStat_TableStatus *tablestatus = NULL;
+ RelFileLocator locator;
+
+ if (!pgstat_reloid_to_relfilelocator(rel_id, &locator))
+ return NULL;
+
+ entry_ref = pgstat_fetch_pending_entry(PGSTAT_KIND_RELATION,
+ locator.dbOid,
+ RelFileLocatorToPgStatObjid(locator));
- entry_ref = pgstat_fetch_pending_entry(PGSTAT_KIND_RELATION, MyDatabaseId, rel_id);
if (!entry_ref)
- {
- entry_ref = pgstat_fetch_pending_entry(PGSTAT_KIND_RELATION, InvalidOid, rel_id);
- if (!entry_ref)
- return tablestatus;
- }
+ return tablestatus;
tabentry = (PgStat_TableStatus *) entry_ref->pending;
tablestatus = palloc_object(PgStat_TableStatus);
@@ -706,8 +777,12 @@ AtPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state)
record.inserted_pre_truncdrop = trans->inserted_pre_truncdrop;
record.updated_pre_truncdrop = trans->updated_pre_truncdrop;
record.deleted_pre_truncdrop = trans->deleted_pre_truncdrop;
- record.id = tabstat->id;
- record.shared = tabstat->shared;
+
+ if (tabstat->relation != NULL)
+ record.locator = tabstat->relation->rd_locator;
+ else
+ record.locator = tabstat->locator;
+
record.truncdropped = trans->truncdropped;
RegisterTwoPhaseRecord(TWOPHASE_RM_PGSTAT_ID, 0,
@@ -750,7 +825,7 @@ pgstat_twophase_postcommit(FullTransactionId fxid, uint16 info,
PgStat_TableStatus *pgstat_info;
/* Find or create a tabstat entry for the rel */
- pgstat_info = pgstat_prep_relation_pending(rec->id, rec->shared);
+ pgstat_info = pgstat_prep_relation_pending(rec->locator);
/* Same math as in AtEOXact_PgStat, commit case */
pgstat_info->counts.tuples_inserted += rec->tuples_inserted;
@@ -785,8 +860,8 @@ pgstat_twophase_postabort(FullTransactionId fxid, uint16 info,
TwoPhasePgStatRecord *rec = (TwoPhasePgStatRecord *) recdata;
PgStat_TableStatus *pgstat_info;
- /* Find or create a tabstat entry for the rel */
- pgstat_info = pgstat_prep_relation_pending(rec->id, rec->shared);
+ /* Find or create a tabstat entry for the target locator */
+ pgstat_info = pgstat_prep_relation_pending(rec->locator);
/* Same math as in AtEOXact_PgStat, abort case */
if (rec->truncdropped)
@@ -920,17 +995,21 @@ pgstat_relation_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts)
* initialized if not exists.
*/
static PgStat_TableStatus *
-pgstat_prep_relation_pending(Oid rel_id, bool isshared)
+pgstat_prep_relation_pending(RelFileLocator locator)
{
PgStat_EntryRef *entry_ref;
PgStat_TableStatus *pending;
+ uint64 objid;
+
+ objid = RelFileLocatorToPgStatObjid(locator);
entry_ref = pgstat_prep_pending_entry(PGSTAT_KIND_RELATION,
- isshared ? InvalidOid : MyDatabaseId,
- rel_id, NULL);
+ locator.dbOid,
+ objid, NULL);
+
pending = entry_ref->pending;
- pending->id = rel_id;
- pending->shared = isshared;
+ pending->id = objid;
+ pending->locator = locator;
return pending;
}
@@ -1009,3 +1088,82 @@ restore_truncdrop_counters(PgStat_TableXactStatus *trans)
trans->tuples_deleted = trans->deleted_pre_truncdrop;
}
}
+
+/*
+ * Convert a relation OID to its corresponding RelFileLocator for statistics
+ * tracking purposes.
+ *
+ * Returns true on success, false if the relation doesn't need statistics
+ * tracking.
+ *
+ * For partitioned tables, constructs a synthetic locator using the relation
+ * OID as relNumber, since they don't have storage.
+ */
+bool
+pgstat_reloid_to_relfilelocator(Oid reloid, RelFileLocator *locator)
+{
+ HeapTuple tuple;
+ Form_pg_class relform;
+ bool result = true;
+
+ /* get the relation's tuple from pg_class */
+ tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(reloid));
+
+ if (!HeapTupleIsValid(tuple))
+ return false;
+
+ relform = (Form_pg_class) GETSTRUCT(tuple);
+
+ /* skip relations without storage and non partitioned tables */
+ if (!RELKIND_HAS_STORAGE(relform->relkind) &&
+ relform->relkind != RELKIND_PARTITIONED_TABLE)
+ {
+ ReleaseSysCache(tuple);
+ return false;
+ }
+
+ if (relform->relkind != RELKIND_PARTITIONED_TABLE)
+ {
+ /* build the RelFileLocator */
+ locator->relNumber = relform->relfilenode;
+ locator->spcOid = relform->reltablespace;
+
+ /* handle default tablespace */
+ if (!OidIsValid(locator->spcOid))
+ locator->spcOid = MyDatabaseTableSpace;
+
+ /* handle dbOid for global vs local relations */
+ if (locator->spcOid == GLOBALTABLESPACE_OID)
+ locator->dbOid = InvalidOid;
+ else
+ locator->dbOid = MyDatabaseId;
+
+ /* handle mapped relations */
+ if (!RelFileNumberIsValid(locator->relNumber))
+ {
+ locator->relNumber = RelationMapOidToFilenumber(reloid,
+ relform->relisshared);
+ if (!RelFileNumberIsValid(locator->relNumber))
+ {
+ ReleaseSysCache(tuple);
+ return false;
+ }
+ }
+ }
+ else
+ {
+ /*
+ * Partitioned tables don't have storage, so construct a synthetic
+ * locator for statistics tracking. Use a reserved pseudo tablespace
+ * OID that cannot conflict with real tablespaces, and the relation
+ * OID as relNumber. This ensures no collision with regular relations
+ * even after OID wraparound.
+ */
+ locator->dbOid = (relform->relisshared ? InvalidOid : MyDatabaseId);
+ locator->spcOid = PSEUDO_PARTITION_TABLE_SPCOID;
+ locator->relNumber = relform->oid;
+ }
+
+ ReleaseSysCache(tuple);
+ return result;
+}
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index b1df96e7b0b..a5a00d6f018 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -23,13 +23,13 @@
#include "common/ip.h"
#include "funcapi.h"
#include "miscadmin.h"
-#include "pgstat.h"
#include "postmaster/bgworker.h"
#include "replication/logicallauncher.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "utils/acl.h"
#include "utils/builtins.h"
+#include "utils/pgstat_internal.h"
#include "utils/timestamp.h"
#define UINT32_ACCESS_ONCE(var) ((uint32)(*((volatile uint32 *)&(var))))
@@ -1961,9 +1961,14 @@ Datum
pg_stat_reset_single_table_counters(PG_FUNCTION_ARGS)
{
Oid taboid = PG_GETARG_OID(0);
- Oid dboid = (IsSharedRelation(taboid) ? InvalidOid : MyDatabaseId);
+ RelFileLocator locator;
- pgstat_reset(PGSTAT_KIND_RELATION, dboid, taboid);
+ /* Get the stats locator from the relation OID */
+ if (!pgstat_reloid_to_relfilelocator(taboid, &locator))
+ PG_RETURN_VOID();
+
+ pgstat_reset(PGSTAT_KIND_RELATION, locator.dbOid,
+ RelFileLocatorToPgStatObjid(locator));
PG_RETURN_VOID();
}
@@ -2317,5 +2322,16 @@ pg_stat_have_stats(PG_FUNCTION_ARGS)
uint64 objid = PG_GETARG_INT64(2);
PgStat_Kind kind = pgstat_get_kind_from_str(stats_type);
+ /* Convert relation OID to relfilenode objid */
+ if (kind == PGSTAT_KIND_RELATION)
+ {
+ RelFileLocator locator;
+
+ if (!pgstat_reloid_to_relfilelocator(objid, &locator))
+ PG_RETURN_BOOL(false);
+
+ objid = RelFileLocatorToPgStatObjid(locator);
+ }
+
PG_RETURN_BOOL(pgstat_have_entry(kind, dboid, objid));
}
diff --git a/src/include/catalog/pg_tablespace.dat b/src/include/catalog/pg_tablespace.dat
index c4cde415219..73ed046be31 100644
--- a/src/include/catalog/pg_tablespace.dat
+++ b/src/include/catalog/pg_tablespace.dat
@@ -10,6 +10,10 @@
#
#----------------------------------------------------------------------
+/*
+ * When adding a new one, ensure it does not conflict with
+ * PSEUDO_PARTITION_TABLE_SPCOID.
+ */
[
{ oid => '1663', oid_symbol => 'DEFAULTTABLESPACE_OID',
diff --git a/src/include/catalog/pg_tablespace.h b/src/include/catalog/pg_tablespace.h
index fe7a5ab538f..f511adc3965 100644
--- a/src/include/catalog/pg_tablespace.h
+++ b/src/include/catalog/pg_tablespace.h
@@ -21,6 +21,14 @@
#include "catalog/genbki.h"
#include "catalog/pg_tablespace_d.h" /* IWYU pragma: export */
+/*
+ * Reserved tablespace OID for partitioned table pseudo locators.
+ * This is not an actual tablespace, just a reserved value to distinguish
+ * partitioned table statistics from regular table statistics. Ensures it does
+ * not conflict with the ones in pg_tablespace.dat.
+ */
+#define PSEUDO_PARTITION_TABLE_SPCOID 1665
+
/* ----------------
* pg_tablespace definition. cpp turns this into
* typedef struct FormData_pg_tablespace
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 9bb777c3d5a..e9e4d32c3b8 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -16,6 +16,7 @@
#include "portability/instr_time.h"
#include "postmaster/pgarch.h" /* for MAX_XFN_CHARS */
#include "replication/conflict.h"
+#include "storage/relfilelocator.h"
#include "utils/backend_progress.h" /* for backward compatibility */ /* IWYU pragma: export */
#include "utils/backend_status.h" /* for backward compatibility */ /* IWYU pragma: export */
#include "utils/pgstat_kind.h"
@@ -34,6 +35,12 @@
/* Default directory to store temporary statistics data in */
#define PG_STAT_TMP_DIR "pg_stat_tmp"
+/*
+ * Build a pgstat key Objid based on a RelFileLocator.
+ */
+#define RelFileLocatorToPgStatObjid(locator) \
+ (((uint64) (locator).spcOid << 32) | (locator).relNumber)
+
/* Values for track_functions GUC variable --- order is significant! */
typedef enum TrackFunctionsLevel
{
@@ -174,11 +181,11 @@ typedef struct PgStat_TableCounts
*/
typedef struct PgStat_TableStatus
{
- Oid id; /* table's OID */
- bool shared; /* is it a shared catalog? */
+ uint64 id; /* hash of relfilelocator for stats key */
struct PgStat_TableXactStatus *trans; /* lowest subxact's counts */
PgStat_TableCounts counts; /* event counts to be sent */
Relation relation; /* rel that is using this entry */
+ RelFileLocator locator; /* table's relfilelocator */
} PgStat_TableStatus;
/* ----------
@@ -734,8 +741,8 @@ extern void pgstat_twophase_postabort(FullTransactionId fxid, uint16 info,
void *recdata, uint32 len);
extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry(Oid relid);
-extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry_ext(bool shared,
- Oid reloid);
+extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry_by_locator(RelFileLocator locator);
+extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry_ext(Oid reloid);
extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id);
diff --git a/src/include/utils/pgstat_internal.h b/src/include/utils/pgstat_internal.h
index 9b8fbae00ed..42f29496551 100644
--- a/src/include/utils/pgstat_internal.h
+++ b/src/include/utils/pgstat_internal.h
@@ -765,6 +765,7 @@ extern void PostPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state);
extern bool pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait);
extern void pgstat_relation_delete_pending_cb(PgStat_EntryRef *entry_ref);
extern void pgstat_relation_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts);
+extern bool pgstat_reloid_to_relfilelocator(Oid reloid, RelFileLocator *locator);
/*
diff --git a/src/test/recovery/t/029_stats_restart.pl b/src/test/recovery/t/029_stats_restart.pl
index cdc427dbc78..4d00087dc6f 100644
--- a/src/test/recovery/t/029_stats_restart.pl
+++ b/src/test/recovery/t/029_stats_restart.pl
@@ -55,10 +55,10 @@ trigger_funcrel_stat();
# verify stats objects exist
$sect = "initial";
-is(have_stats('database', $dboid, 0), 't', "$sect: db stats do exist");
-is(have_stats('function', $dboid, $funcoid),
+is(have_stats($connect_db, 'database', $dboid, 0), 't', "$sect: db stats do exist");
+is(have_stats($db_under_test, 'function', $dboid, $funcoid),
't', "$sect: function stats do exist");
-is(have_stats('relation', $dboid, $tableoid),
+is(have_stats($db_under_test, 'relation', $dboid, $tableoid),
't', "$sect: relation stats do exist");
# regular shutdown
@@ -79,10 +79,10 @@ copy($og_stats, $statsfile) or die "Copy failed: $!";
$node->start;
$sect = "copy";
-is(have_stats('database', $dboid, 0), 't', "$sect: db stats do exist");
-is(have_stats('function', $dboid, $funcoid),
+is(have_stats($connect_db, 'database', $dboid, 0), 't', "$sect: db stats do exist");
+is(have_stats($db_under_test, 'function', $dboid, $funcoid),
't', "$sect: function stats do exist");
-is(have_stats('relation', $dboid, $tableoid),
+is(have_stats($db_under_test, 'relation', $dboid, $tableoid),
't', "$sect: relation stats do exist");
$node->stop('immediate');
@@ -96,10 +96,10 @@ $node->start;
# stats should have been discarded
$sect = "post immediate";
-is(have_stats('database', $dboid, 0), 'f', "$sect: db stats do not exist");
-is(have_stats('function', $dboid, $funcoid),
+is(have_stats($connect_db, 'database', $dboid, 0), 'f', "$sect: db stats do not exist");
+is(have_stats($db_under_test, 'function', $dboid, $funcoid),
'f', "$sect: function stats do exist");
-is(have_stats('relation', $dboid, $tableoid),
+is(have_stats($db_under_test, 'relation', $dboid, $tableoid),
'f', "$sect: relation stats do not exist");
# get rid of backup statsfile
@@ -110,10 +110,10 @@ unlink $statsfile or die "cannot unlink $statsfile $!";
trigger_funcrel_stat();
$sect = "post immediate, new";
-is(have_stats('database', $dboid, 0), 't', "$sect: db stats do exist");
-is(have_stats('function', $dboid, $funcoid),
+is(have_stats($connect_db, 'database', $dboid, 0), 't', "$sect: db stats do exist");
+is(have_stats($db_under_test, 'function', $dboid, $funcoid),
't', "$sect: function stats do exist");
-is(have_stats('relation', $dboid, $tableoid),
+is(have_stats($db_under_test, 'relation', $dboid, $tableoid),
't', "$sect: relation stats do exist");
# regular shutdown
@@ -129,10 +129,10 @@ $node->start;
# no stats present due to invalid stats file
$sect = "invalid_overwrite";
-is(have_stats('database', $dboid, 0), 'f', "$sect: db stats do not exist");
-is(have_stats('function', $dboid, $funcoid),
+is(have_stats($connect_db, 'database', $dboid, 0), 'f', "$sect: db stats do not exist");
+is(have_stats($db_under_test, 'function', $dboid, $funcoid),
'f', "$sect: function stats do not exist");
-is(have_stats('relation', $dboid, $tableoid),
+is(have_stats($db_under_test, 'relation', $dboid, $tableoid),
'f', "$sect: relation stats do not exist");
@@ -145,10 +145,10 @@ append_file($og_stats, "XYZ");
$node->start;
$sect = "invalid_append";
-is(have_stats('database', $dboid, 0), 'f', "$sect: db stats do not exist");
-is(have_stats('function', $dboid, $funcoid),
+is(have_stats($connect_db, 'database', $dboid, 0), 'f', "$sect: db stats do not exist");
+is(have_stats($db_under_test, 'function', $dboid, $funcoid),
'f', "$sect: function stats do not exist");
-is(have_stats('relation', $dboid, $tableoid),
+is(have_stats($db_under_test, 'relation', $dboid, $tableoid),
'f', "$sect: relation stats do not exist");
@@ -307,9 +307,9 @@ sub trigger_funcrel_stat
sub have_stats
{
- my ($kind, $dboid, $objid) = @_;
+ my ($db, $kind, $dboid, $objid) = @_;
- return $node->safe_psql($connect_db,
+ return $node->safe_psql($db,
"SELECT pg_stat_have_stats('$kind', $dboid, $objid)");
}
--
2.34.1
--zLA8DXafBEP889wv
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v11-0002-handle-relation-statistics-correctly-during-rewr.patch"
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v5 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--ZcI1PtyEAe3VcVeQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v5-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v6 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
src/bin/psql/tab-complete.in.c | 46 +++----
4 files changed, 27 insertions(+), 288 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index af3935b0078..ce99137c613 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 46b9add0604..f4d842966bf 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1209,6 +1209,18 @@ Keywords_for_list_of_owner_roles, "PUBLIC"
" FROM pg_catalog.pg_timezone_names() "\
" WHERE pg_catalog.quote_literal(pg_catalog.lower(name)) LIKE pg_catalog.lower('%s')"
+#define Query_for_list_of_publications \
+"SELECT pubname "\
+" FROM pg_catalog.pg_publication "\
+" WHERE pubname LIKE '%s'"
+
+#define Query_for_list_of_subscriptions \
+"SELECT s.subname "\
+" FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d"\
+" WHERE s.subname LIKE '%s' "\
+" AND d.datname = pg_catalog.current_database() "\
+" AND s.subdbid = d.oid"
+
/* Privilege options shared between GRANT and REVOKE */
#define Privilege_options_of_grant_and_revoke \
"SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", \
@@ -1243,32 +1255,6 @@ Copy_common_options, "DEFAULT", "FORCE_NOT_NULL", "FORCE_NULL", "FREEZE", \
#define Copy_to_options \
Copy_common_options, "FORCE_QUOTE", "FORCE_ARRAY"
-/*
- * These object types were introduced later than our support cutoff of
- * server version 9.2. We use the VersionedQuery infrastructure so that
- * we don't send certain-to-fail queries to older servers.
- */
-
-static const VersionedQuery Query_for_list_of_publications[] = {
- {100000,
- " SELECT pubname "
- " FROM pg_catalog.pg_publication "
- " WHERE pubname LIKE '%s'"
- },
- {0, NULL}
-};
-
-static const VersionedQuery Query_for_list_of_subscriptions[] = {
- {100000,
- " SELECT s.subname "
- " FROM pg_catalog.pg_subscription s, pg_catalog.pg_database d "
- " WHERE s.subname LIKE '%s' "
- " AND d.datname = pg_catalog.current_database() "
- " AND s.subdbid = d.oid"
- },
- {0, NULL}
-};
-
/* Known command-starting keywords. */
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -1346,7 +1332,7 @@ static const pgsql_thing_t words_after_create[] = {
{"POLICY", NULL, NULL, NULL},
{"PROCEDURE", NULL, NULL, Query_for_list_of_procedures},
{"PROPERTY GRAPH", NULL, NULL, &Query_for_list_of_propgraphs},
- {"PUBLICATION", NULL, Query_for_list_of_publications},
+ {"PUBLICATION", Query_for_list_of_publications},
{"ROLE", Query_for_list_of_roles},
{"ROUTINE", NULL, NULL, &Query_for_list_of_routines, NULL, THING_NO_CREATE},
{"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE rulename LIKE '%s'"},
@@ -1354,7 +1340,7 @@ static const pgsql_thing_t words_after_create[] = {
{"SEQUENCE", NULL, NULL, &Query_for_list_of_sequences},
{"SERVER", Query_for_list_of_servers},
{"STATISTICS", NULL, NULL, &Query_for_list_of_statistics},
- {"SUBSCRIPTION", NULL, Query_for_list_of_subscriptions},
+ {"SUBSCRIPTION", Query_for_list_of_subscriptions},
{"SYSTEM", NULL, NULL, NULL, NULL, THING_NO_CREATE | THING_NO_DROP},
{"TABLE", NULL, NULL, &Query_for_list_of_tables},
{"TABLESPACE", Query_for_list_of_tablespaces},
@@ -5701,9 +5687,9 @@ match_previous_words(int pattern_id,
else if (TailMatchesCS("\\dP*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_partitioned_relations);
else if (TailMatchesCS("\\dRp*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_publications);
+ COMPLETE_WITH_QUERY(Query_for_list_of_publications);
else if (TailMatchesCS("\\dRs*"))
- COMPLETE_WITH_VERSIONED_QUERY(Query_for_list_of_subscriptions);
+ COMPLETE_WITH_QUERY(Query_for_list_of_subscriptions);
else if (TailMatchesCS("\\ds*"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_sequences);
else if (TailMatchesCS("\\dt*"))
--
2.50.1 (Apple Git-155)
--aHl3HfeiUuO3zeNC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v6-0004-run-pgindent-and-pgperltidy.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v2 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +--
src/bin/psql/describe.c | 255 +--------------------------------
3 files changed, 11 insertions(+), 269 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..76d299fb55c 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -98,20 +98,12 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Result data type"),
gettext_noop("Argument data types"));
- if (pset.sversion >= 110000)
appendPQExpBuffer(&buf,
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
"FROM pg_catalog.pg_proc p\n"
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
"WHERE p.prokind = " CppAsString2(PROKIND_AGGREGATE) "\n",
gettext_noop("Description"));
- else
- appendPQExpBuffer(&buf,
- " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
- "FROM pg_catalog.pg_proc p\n"
- " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
- "WHERE p.proisagg\n",
- gettext_noop("Description"));
if (!showSystem && !pattern)
appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n"
@@ -154,16 +146,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +294,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +379,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +591,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1078,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1604,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1621,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1648,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1667,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1688,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1905,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2059,14 +1916,11 @@ describeOneTableDetails(const char *schemaname,
if (tableinfo.relkind == RELKIND_INDEX ||
tableinfo.relkind == RELKIND_PARTITIONED_INDEX)
{
- if (pset.sversion >= 110000)
- {
appendPQExpBuffer(&buf, ",\n CASE WHEN a.attnum <= (SELECT i.indnkeyatts FROM pg_catalog.pg_index i WHERE i.indexrelid = '%s') THEN '%s' ELSE '%s' END AS is_key",
oid,
gettext_noop("yes"),
gettext_noop("no"));
isindexkey_col = cols++;
- }
appendPQExpBufferStr(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
indexdef_col = cols++;
}
@@ -2461,10 +2315,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2420,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2671,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2746,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2848,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3014,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3123,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3544,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3554,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3794,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3849,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4339,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4846,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4915,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5144,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5152,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6475,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6612,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6862,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--CT89ko5pLUrsvFtH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v2-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v3 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 493400f9090..c9573d4b765 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6272,15 +6272,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6291,19 +6289,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index e1449654f96..9f26ed928cb 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--6vzYk1swa63ey9i6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v3-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
* [PATCH v4 3/4] psql: bump minimum supported version to v10
@ 2026-04-17 18:34 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 467+ messages in thread
From: Nathan Bossart @ 2026-04-17 18:34 UTC (permalink / raw)
---
doc/src/sgml/ref/psql-ref.sgml | 2 +-
src/bin/psql/command.c | 23 +---
src/bin/psql/describe.c | 244 +--------------------------------
3 files changed, 11 insertions(+), 258 deletions(-)
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 7c05afd4719..56c2692e618 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -5523,7 +5523,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line '
or an older major version. Backslash commands are particularly likely
to fail if the server is of a newer version than <application>psql</application>
itself. However, backslash commands of the <literal>\d</literal> family should
- work with servers of versions back to 9.2, though not necessarily with
+ work with servers of versions back to 10, though not necessarily with
servers newer than <application>psql</application> 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 01b8f11aadd..44ef11d980e 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4471,10 +4471,10 @@ connection_warnings(bool in_startup)
/*
* Warn if server's major version is newer than ours, or if server
- * predates our support cutoff (currently 9.2).
+ * predates our support cutoff (currently 10).
*/
if (pset.sversion / 100 > client_ver / 100 ||
- pset.sversion < 90200)
+ pset.sversion < 100000)
printf(_("WARNING: %s major version %s, server major version %s.\n"
" Some psql features might not work.\n"),
pset.progname,
@@ -6278,15 +6278,13 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
* ensure the right view gets replaced. Also, check relation kind
* to be sure it's a view.
*
- * Starting with PG 9.4, views may have WITH [LOCAL|CASCADED]
+ * Views may have WITH [LOCAL|CASCADED]
* CHECK OPTION. These are not part of the view definition
* returned by pg_get_viewdef() and so need to be retrieved
- * separately. Materialized views (introduced in 9.3) may have
+ * separately. Materialized views may have
* arbitrary storage parameter reloptions.
*/
printfPQExpBuffer(query, "/* %s */\n", _("Get view's definition and details"));
- if (pset.sversion >= 90400)
- {
appendPQExpBuffer(query,
"SELECT nspname, relname, relkind, "
"pg_catalog.pg_get_viewdef(c.oid, true), "
@@ -6297,19 +6295,6 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid,
"LEFT JOIN pg_catalog.pg_namespace n "
"ON c.relnamespace = n.oid WHERE c.oid = %u",
oid);
- }
- else
- {
- appendPQExpBuffer(query,
- "SELECT nspname, relname, relkind, "
- "pg_catalog.pg_get_viewdef(c.oid, true), "
- "c.reloptions AS reloptions, "
- "NULL AS checkoption "
- "FROM pg_catalog.pg_class c "
- "LEFT JOIN pg_catalog.pg_namespace n "
- "ON c.relnamespace = n.oid WHERE c.oid = %u",
- oid);
- }
break;
}
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 7f9b2b71a36..ec9c61ee924 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3,9 +3,9 @@
*
* Support for the various \d ("describe") commands. Note that the current
* expectation is that all functions in this file will succeed when working
- * with servers of versions 9.2 and up. It's okay to omit irrelevant
+ * with servers of versions 10 and up. It's okay to omit irrelevant
* information for an old server, but not to fail outright. (But failing
- * against a pre-9.2 server is allowed.)
+ * against a pre-10 server is allowed.)
*
* Copyright (c) 2000-2026, PostgreSQL Global Development Group
*
@@ -154,16 +154,6 @@ describeAccessMethods(const char *pattern, bool verbose)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, true, false, false};
- if (pset.sversion < 90600)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support access methods.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching access methods"));
@@ -312,9 +302,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, true, true, true, false, true, true, false, false, false, false};
- /* No "Parallel" column before 9.6 */
- static const bool translate_columns_pre_96[] = {false, false, false, false, true, true, false, true, true, false, false, false, false};
-
if (strlen(functypes) != strspn(functypes, df_options))
{
pg_log_error("\\df only takes [%s] as options", df_options);
@@ -400,7 +387,6 @@ describeFunctions(const char *functypes, const char *func_pattern,
gettext_noop("stable"),
gettext_noop("volatile"),
gettext_noop("Volatility"));
- if (pset.sversion >= 90600)
appendPQExpBuffer(&buf,
",\n CASE\n"
" WHEN p.proparallel = "
@@ -613,16 +599,8 @@ describeFunctions(const char *functypes, const char *func_pattern,
myopt.title = _("List of functions");
myopt.translate_header = true;
- if (pset.sversion >= 90600)
- {
myopt.translate_columns = translate_columns;
myopt.n_translate_columns = lengthof(translate_columns);
- }
- else
- {
- myopt.translate_columns = translate_columns_pre_96;
- myopt.n_translate_columns = lengthof(translate_columns_pre_96);
- }
printQuery(res, &myopt, pset.queryFout, false, pset.logfile);
@@ -1108,38 +1086,6 @@ permissionsList(const char *pattern, bool showSystem)
" ), E'\\n') AS \"%s\"",
gettext_noop("Column privileges"));
- if (pset.sversion >= 90500 && pset.sversion < 100000)
- appendPQExpBuffer(&buf,
- ",\n pg_catalog.array_to_string(ARRAY(\n"
- " SELECT polname\n"
- " || CASE WHEN polcmd != '*' THEN\n"
- " E' (' || polcmd::pg_catalog.text || E'):'\n"
- " ELSE E':'\n"
- " END\n"
- " || CASE WHEN polqual IS NOT NULL THEN\n"
- " E'\\n (u): ' || pg_catalog.pg_get_expr(polqual, polrelid)\n"
- " ELSE E''\n"
- " END\n"
- " || CASE WHEN polwithcheck IS NOT NULL THEN\n"
- " E'\\n (c): ' || pg_catalog.pg_get_expr(polwithcheck, polrelid)\n"
- " ELSE E''\n"
- " END"
- " || CASE WHEN polroles <> '{0}' THEN\n"
- " E'\\n to: ' || pg_catalog.array_to_string(\n"
- " ARRAY(\n"
- " SELECT rolname\n"
- " FROM pg_catalog.pg_roles\n"
- " WHERE oid = ANY (polroles)\n"
- " ORDER BY 1\n"
- " ), E', ')\n"
- " ELSE E''\n"
- " END\n"
- " FROM pg_catalog.pg_policy pol\n"
- " WHERE polrelid = c.oid), E'\\n')\n"
- " AS \"%s\"",
- gettext_noop("Policies"));
-
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
",\n pg_catalog.array_to_string(ARRAY(\n"
" SELECT polname\n"
@@ -1666,7 +1612,7 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 100000)
+ else
{
appendPQExpBuffer(&buf,
"SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
@@ -1683,57 +1629,6 @@ describeOneTableDetails(const char *schemaname,
: "''"),
oid);
}
- else if (pset.sversion >= 90500)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, "
- "c.relhasoids, false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else if (pset.sversion >= 90400)
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence, c.relreplident\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, "
- "c.relhastriggers, false, false, c.relhasoids, "
- "false as relispartition, %s, c.reltablespace, "
- "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, "
- "c.relpersistence\n"
- "FROM pg_catalog.pg_class c\n "
- "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n"
- "WHERE c.oid = '%s';",
- (verbose ?
- "pg_catalog.array_to_string(c.reloptions || "
- "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n"
- : "''"),
- oid);
- }
res = PSQLexec(buf.data);
if (!res)
@@ -1761,8 +1656,7 @@ describeOneTableDetails(const char *schemaname,
tableinfo.reloftype = (strcmp(PQgetvalue(res, 0, 11), "") != 0) ?
pg_strdup(PQgetvalue(res, 0, 11)) : NULL;
tableinfo.relpersistence = *(PQgetvalue(res, 0, 12));
- tableinfo.relreplident = (pset.sversion >= 90400) ?
- *(PQgetvalue(res, 0, 13)) : 'd';
+ tableinfo.relreplident = *(PQgetvalue(res, 0, 13));
if (pset.sversion >= 120000)
tableinfo.relam = PQgetisnull(res, 0, 14) ?
NULL : pg_strdup(PQgetvalue(res, 0, 14));
@@ -1781,8 +1675,6 @@ describeOneTableDetails(const char *schemaname,
char *footers[3] = {NULL, NULL, NULL};
printfPQExpBuffer(&buf, "/* %s */\n", _("Get sequence information"));
- if (pset.sversion >= 100000)
- {
appendPQExpBuffer(&buf,
"SELECT pg_catalog.format_type(seqtypid, NULL) AS \"%s\",\n"
" seqstart AS \"%s\",\n"
@@ -1804,30 +1696,6 @@ describeOneTableDetails(const char *schemaname,
"FROM pg_catalog.pg_sequence\n"
"WHERE seqrelid = '%s';",
oid);
- }
- else
- {
- appendPQExpBuffer(&buf,
- "SELECT 'bigint' AS \"%s\",\n"
- " start_value AS \"%s\",\n"
- " min_value AS \"%s\",\n"
- " max_value AS \"%s\",\n"
- " increment_by AS \"%s\",\n"
- " CASE WHEN is_cycled THEN '%s' ELSE '%s' END AS \"%s\",\n"
- " cache_value AS \"%s\"\n",
- gettext_noop("Type"),
- gettext_noop("Start"),
- gettext_noop("Minimum"),
- gettext_noop("Maximum"),
- gettext_noop("Increment"),
- gettext_noop("yes"),
- gettext_noop("no"),
- gettext_noop("Cycles?"),
- gettext_noop("Cache"));
- appendPQExpBuffer(&buf, "FROM %s", fmtId(schemaname));
- /* must be separate because fmtId isn't reentrant */
- appendPQExpBuffer(&buf, ".%s;", fmtId(relationname));
- }
res = PSQLexec(buf.data);
if (!res)
@@ -2045,10 +1913,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBufferStr(&buf, ",\n (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
" WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
attcoll_col = cols++;
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf, ",\n a.attidentity");
- else
- appendPQExpBufferStr(&buf, ",\n ''::pg_catalog.char AS attidentity");
attidentity_col = cols++;
if (pset.sversion >= 120000)
appendPQExpBufferStr(&buf, ",\n a.attgenerated");
@@ -2461,10 +2326,7 @@ describeOneTableDetails(const char *schemaname,
CppAsString2(CONSTRAINT_EXCLUSION) ") AND "
"condeferred) AS condeferred,\n");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, "i.indisreplident,\n");
- else
- appendPQExpBufferStr(&buf, "false AS indisreplident,\n");
if (pset.sversion >= 150000)
appendPQExpBufferStr(&buf, "i.indnullsnotdistinct,\n");
@@ -2569,10 +2431,7 @@ describeOneTableDetails(const char *schemaname,
"pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "
"pg_catalog.pg_get_constraintdef(con.oid, true), "
"contype, condeferrable, condeferred");
- if (pset.sversion >= 90400)
appendPQExpBufferStr(&buf, ", i.indisreplident");
- else
- appendPQExpBufferStr(&buf, ", false AS indisreplident");
appendPQExpBufferStr(&buf, ", c2.reltablespace");
if (pset.sversion >= 180000)
appendPQExpBufferStr(&buf, ", con.conperiod");
@@ -2823,17 +2682,11 @@ describeOneTableDetails(const char *schemaname,
PQclear(result);
/* print any row-level policies */
- if (pset.sversion >= 90500)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get row-level policies for this table"));
appendPQExpBufferStr(&buf, "SELECT pol.polname,");
- if (pset.sversion >= 100000)
appendPQExpBufferStr(&buf,
" pol.polpermissive,\n");
- else
- appendPQExpBufferStr(&buf,
- " 't' as polpermissive,\n");
appendPQExpBuffer(&buf,
" CASE WHEN pol.polroles = '{0}' THEN NULL ELSE pg_catalog.array_to_string(array(select rolname from pg_catalog.pg_roles where oid = any (pol.polroles) order by 1),',') END,\n"
" pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n"
@@ -2904,7 +2757,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* print any extended statistics */
if (pset.sversion >= 140000)
@@ -3007,7 +2859,7 @@ describeOneTableDetails(const char *schemaname,
}
PQclear(result);
}
- else if (pset.sversion >= 100000)
+ else
{
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get extended statistics for this table"));
@@ -3173,8 +3025,6 @@ describeOneTableDetails(const char *schemaname,
}
/* print any publications */
- if (pset.sversion >= 100000)
- {
printfPQExpBuffer(&buf, "/* %s */\n",
_("Get publications that publish this table"));
if (pset.sversion >= 150000)
@@ -3284,7 +3134,6 @@ describeOneTableDetails(const char *schemaname,
printTableAddFooter(&cont, buf.data);
}
PQclear(result);
- }
/* Print publications where the table is in the EXCEPT clause */
if (pset.sversion >= 190000)
@@ -3706,7 +3555,7 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else if (pset.sversion >= 100000)
+ else
appendPQExpBuffer(&buf,
"SELECT c.oid::pg_catalog.regclass, c.relkind,"
" false AS inhdetachpending,"
@@ -3716,14 +3565,6 @@ describeOneTableDetails(const char *schemaname,
"ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
" c.oid::pg_catalog.regclass::pg_catalog.text;",
oid);
- else
- appendPQExpBuffer(&buf,
- "SELECT c.oid::pg_catalog.regclass, c.relkind,"
- " false AS inhdetachpending, NULL\n"
- "FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i\n"
- "WHERE c.oid = i.inhrelid AND i.inhparent = '%s'\n"
- "ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;",
- oid);
result = PSQLexec(buf.data);
if (!result)
@@ -3964,11 +3805,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
ncols++;
}
appendPQExpBufferStr(&buf, "\n, r.rolreplication");
-
- if (pset.sversion >= 90500)
- {
appendPQExpBufferStr(&buf, "\n, r.rolbypassrls");
- }
appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_roles r\n");
@@ -4023,7 +3860,6 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
if (strcmp(PQgetvalue(res, i, (verbose ? 9 : 8)), "t") == 0)
add_role_attribute(&buf, _("Replication"));
- if (pset.sversion >= 90500)
if (strcmp(PQgetvalue(res, i, (verbose ? 10 : 9)), "t") == 0)
add_role_attribute(&buf, _("Bypass RLS"));
@@ -4514,19 +4350,6 @@ listPartitionedTables(const char *reltypes, const char *pattern, bool verbose)
const char *tabletitle;
bool mixed_output = false;
- /*
- * Note: Declarative table partitioning is only supported as of Pg 10.0.
- */
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support declarative table partitioning.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
/* If no relation kind was selected, show them all */
if (!showTables && !showIndexes)
showTables = showIndexes = true;
@@ -5034,16 +4857,6 @@ listEventTriggers(const char *pattern, bool verbose)
static const bool translate_columns[] =
{false, false, false, true, false, false, false};
- if (pset.sversion < 90300)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support event triggers.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching event triggers"));
@@ -5113,16 +4926,6 @@ listExtendedStats(const char *pattern, bool verbose)
PGresult *res;
printQueryOpt myopt = pset.popt;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support extended statistics.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching extended statistics"));
@@ -5352,7 +5155,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
gettext_noop("Schema"),
gettext_noop("Name"));
- if (pset.sversion >= 100000)
appendPQExpBuffer(&buf,
" CASE c.collprovider "
"WHEN " CppAsString2(COLLPROVIDER_DEFAULT) " THEN 'default' "
@@ -5361,10 +5163,6 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
"WHEN " CppAsString2(COLLPROVIDER_ICU) " THEN 'icu' "
"END AS \"%s\",\n",
gettext_noop("Provider"));
- else
- appendPQExpBuffer(&buf,
- " 'libc' AS \"%s\",\n",
- gettext_noop("Provider"));
appendPQExpBuffer(&buf,
" c.collcollate AS \"%s\",\n"
@@ -6688,16 +6486,6 @@ listPublications(const char *pattern)
printQueryOpt myopt = pset.popt;
static const bool translate_columns[] = {false, false, false, false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching publications"));
@@ -6835,16 +6623,6 @@ describePublications(const char *pattern)
PQExpBufferData title;
printTableContent cont;
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support publications.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
has_pubsequence = (pset.sversion >= 190000);
has_pubtruncate = (pset.sversion >= 110000);
has_pubgencols = (pset.sversion >= 180000);
@@ -7095,16 +6873,6 @@ describeSubscriptions(const char *pattern, bool verbose)
false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false};
- if (pset.sversion < 100000)
- {
- char sverbuf[32];
-
- pg_log_error("The server (version %s) does not support subscriptions.",
- formatPGVersionNumber(pset.sversion, false,
- sverbuf, sizeof(sverbuf)));
- return true;
- }
-
initPQExpBuffer(&buf);
printfPQExpBuffer(&buf, "/* %s */\n", _("Get matching subscriptions"));
--
2.50.1 (Apple Git-155)
--2xrO7hiVfr8aWtYg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=v4-0004-run-pgindent.patch
^ permalink raw reply [nested|flat] 467+ messages in thread
end of thread, other threads:[~2026-04-17 18:34 UTC | newest]
Thread overview: 467+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-07-09 11:36 [PATCH 4/4] add force_incremental_sort GUC Tomas Vondra <[email protected]>
2023-08-08 00:31 [PATCH v3 01/10] ci: Don't specify amount of memory Andres Freund <[email protected]>
2023-08-08 00:31 [PATCH v1 8/9] ci: Don't specify amount of memory Andres Freund <[email protected]>
2023-08-08 00:31 [PATCH v1 8/9] ci: Don't specify amount of memory Andres Freund <[email protected]>
2023-08-08 00:31 [PATCH v3 01/10] ci: Don't specify amount of memory Andres Freund <[email protected]>
2023-08-08 00:31 [PATCH v1 8/9] ci: Don't specify amount of memory Andres Freund <[email protected]>
2025-10-01 09:45 [PATCH v11 1/2] Key PGSTAT_KIND_RELATION by relfile locator Bertrand Drouvot <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v5 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v6 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v2 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v4 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
2026-04-17 18:34 [PATCH v3 3/4] psql: bump minimum supported version to v10 Nathan Bossart <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox